const express = require('express')
const checkToken = require('./utils/checkToken')
const cros = require('./utils/cros')
const loginRouter = require('./router/login')
const path = require('path')
//创建express实例
const app = express()
//使用静态文件
app.use(express.static('./public'))
app.get('*', function (request, response) {
  response.sendFile(path.resolve(__dirname, 'public', 'index.html'))
})
//支持post请求
app.use(express.json())
app.use(express.urlencoded({ extended: false }))

//跨域
app.use(cros)
//验证权限
app.use(checkToken)

//配置路由
app.use(loginRouter)
app.use(require('./router/Overview/PatientManagement'))
app.use(require('./router/Overview/Overview'))
app.use(require('./router/ChargeManagement/​ChargeManagement'))
app.use(require('./router/Pricing/Pricing'))
app.use(require('./router/EmployeesManagement/EmployeesManagement'))
app.use(require('./router/DrugStatistics/AdjustPrice'))
app.use(require('./router/Registered/Registered'))
app.use(require('./router/DrugStatistics/DrugSales'))
app.use(require('./router/RetailMedicine/RetailMedicine'))
app.use(require('./router/NewVisit/NewVisit'))


app.listen(8081)
console.log('app服务运行中...')
